﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using control.Dal;

namespace control.Biz
{
    public class BizKhachHang
    {
        private int IdKhachHang;

        public int IDKhachHang
        {
            get { return IdKhachHang; }
            set { IdKhachHang = value; }
        }

        

      

        private string makhachhang;
        public string MaKhachHang
        {
            get { return makhachhang; }
            set { makhachhang = value; }
        }


        private string tenDN;

        public string TenDN
        {
            get { return tenDN; }
            set { tenDN = value; }
        }


        private string matkhau;

        public string Matkhau
        {
            get { return matkhau; }
            set { matkhau = value; }
        }




        private string tenKH;

        public string TenKH
        {
            get { return tenKH; }
            set { tenKH = value; }
        }
      


        private string diachi;
        public string Diachi
        {
            get { return diachi; }
            set { diachi = value; }
        }

        private string email;

        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        private int sdt;

        public int SDT
        {
            get { return sdt; }
            set { sdt = value; }
        }

        private BizQuyen quyen;

        public BizQuyen Quyen
        {
            get { return quyen; }
            set { quyen = value; }
        }
        public BizKhachHang()
        {

        }
        public BizKhachHang(int _idkh, string _ma, string _tenDN, string _matkhau, string _tenKH, string _diachi, string _email, int _sdt, BizQuyen _quyen)
        {
            IdKhachHang = _idkh;
            makhachhang = _ma;
            tenDN = _tenDN;
            matkhau = _matkhau;
            tenKH = _tenKH;
            diachi = _diachi;
            email = _email;
            sdt = _sdt;
            quyen = _quyen;


        }
      

        public static List<Biz.BizKhachHang> GetAll()
        {
            return DalKhachHang.GetAll();
        }

        public void add()
        {
            //this.Id = DalKhachHang.Add(this);
            IdKhachHang = DalKhachHang.Add(this);
        }

        public void delete()
        {
            DalKhachHang.Delete(this);
        }

        public bool update = false;
        public void updated()
        {
            DalKhachHang.Updated(this);
        }



        public static BizKhachHang DangNhap(string _username, string _password)
        {
            return DalKhachHang.DangNhap(_username, _password);
        }

        public bool changeInfo()
        {
            return DalKhachHang.changeInfo(this);
        }



        public bool DangKy()
        {
            IdKhachHang = DalKhachHang.Insert(this);
            if (IDKhachHang == -1)
                return false;
            return true;
        }

        public static BizKhachHang FindByUsername(string _username)
        {
            return DalKhachHang.FindByUsername(_username);
        }

      
        public static BizKhachHang GetByID(int p)
        {
            return DalKhachHang.GetByID(p);
        }
    }
}
